STEPPER MOTOR INTERFACING WITH 8051
Stepper motor is one of the commonly used motors for precise angular movement.
Synopsis

Stepper motor is one of the commonly used motors for precise angular movement. The advantage of using a stepper motor is that the angular position of the motor shaft can be controlled without any feedback mechanism. Stepper motors are widely used in industrial and commercial applications. They are also commonly used as in drive systems of autonomous robots. A stepper motor is a brushless, synchronous electric motor that converts digital pulses into mechanical shaft rotation. Every revolution of the stepper motor is divided into a discrete number of steps, and the motor must be sent a separate pulse for each step. This document explains uses the Programmable Counter Array (PCA) of the microcontroller (8051) to generate the control signals to the Power Interface. The Power Interface allows the microcontroller (AT89S52) to drive enough current into coils of a stepper motor. There are two advantages to using PCA. First of all, PCA provides greater accuracy than toggling pins in software because the toggle occurs before the interrupt request is serviced. Thus, interrupt response time does not affect the accuracy of the output. Secondly the microcontroller CPU is left free for application task execution while the PCA drives stepper motors. There are two major types of stepper motors: Permanent magnet stepper motors (unipolar stepper motors and bipolar stepper motors) and variable reluctance stepper motors (hybrid stepper motors).

Description

Stepper motors are often controlled using special function ICs that provide limited control functionality. Such ICs often employ a rudimentary step forward and back interface to the microprocessor that limits system performance. Other stepper motor systems are PC card based and use a host PC to provide high performance control.

Motor

There are several types of stepper motors, these cannot be driven in the same way. In this application note, we have chosen to drive a unipolar stepper motor (see Figure 1). For more information you will find schemes to identify the other types of stepper motors. Unipolar stepper motors are characterized by their center-tapped windings.

Unipolar stepper motor

Stepper motors are very accurate motors that are commonly used in computer disk drives, printers and clocks. Unlike dc motors, which spin round freely when power is applied, stepper motors require that their power supply be continuously pulsed in specific patterns. For each pulse, the stepper motor moves around one ‘step’, often 7.5 degrees (giving 48 steps in a full revolution). As the stepper motor operates at 12V, the standard transistor circuit is required to switch each coil. As the coils create a back EMF when switched off, a suppression diode on each coil is also required. The table below show the four different steps required to make the motor turn. Look carefully at the table, and notice that a pattern is visible. Coil 2 is always the opposite (or logical NOT) of coil 1. The same applies for coils 3 and 4. It is therefore possible to cut down the number of microcontroller pins required to just two by the use of two additional NOT gates


Bipolar Stepper Motor

Bipolar stepper motors are designed with separate coils. The bipolar stepper motor has two coils that must be controlled so that the current flows in different directions through the coils in a certain order. The changing magnetic fields that these coils create cause the rotor of the motor to move around in steps.


Variable Reluctance stepper motor (hybrid stepper motors)

This type of motor are characterized by one common lead.


The ULN2003A is a current driver IC. It is used to drive the current of the stepper motor as it requires more than 60mA of current. It is an array of Darlington pairs. It consists of seven pairs of Darlington arrays with common emitter. The IC consists of 16 pins in which 7 are input pins, 7 are output pins and remaining are VCC and Ground. The first four input pins are connected to the microcontroller. In the same way, four output pins are connected to the stepper motor. Stepper motor has 6 pins. In these six pins, 2 pins are connected to the supply of 12V and the remaining are connected to the output of the stepper motor. Stepper rotates at a given step angle. Each step in rotation is a fraction of full cycle. This depends on the mechanical parts and the driving method. Similar to all the motors, stepper motors will have stator and rotor. Rotor has permanent magnet and stator has coil. The basic stepper motor has 4 coils with 90 degrees rotation step. These four coils are activated in the cyclic order.

Driving Unipolar Stepper Motors

There are three ways to drive unipolar stepper motors (one phase on, two phase on or half step), each one has some advantages and disadvantages. One Phase ON Mode (Full Step mode)



In one phase mode, each successive coil is energized in turn. One phase mode produces smooth rotations and the lowest power consumption of the three modes. Steps are applied in order from one to four. After step four, the sequence is repeated from step one. Applying steps from one to four makes the motor run clockwise, reversing the order of step from four to one will make the motor run counter-clockwise.


Two Phases ON Mode (Alternate Full step Mode)

In two phase mode, successive pairs of adjacent coils are energized in turn, motion is not as smooth as in one phase mode, power consumption is more important but it produces greater torque. As in one phase mode, applying the steps in order makes the stepper motor run clockwise and reversing order makes it turn counter-clockwise.




Half Step Mode


The half step sequence is a mix of one phase on and two phase on sequences. The main advantage of this mode is to increase by two the nominal number of steps of your stepper motor. By example, a unipolar stepper motor of 24 steps of 15 degrees each "becomes", when we use half step mode, a stepper motor of 48 steps of 7.5 degrees.




Application:

Stepper motors are used in a wide variety of applications.

1. They are relevant in consumer office equipment such as printers, plotters, copiers, and scanners.

2. Stepper motors are also used in automotive applications for electronic throttle control, dashboard indicators, and climate control systems.

3. Stepper motors are also found in industrial equipment such as robotics, electronic component handlers, testers, dispensers, and other manufacturing equipment.

Proteus design for Unipolar Stepper Motor interfacing with 8051


Proteus design for Bipolar Stepper Motor interfacing with 8051


Orcad design for Unipolar Stepper Motor interfacing with 8051


Orcad design for Bipolar Stepper Motor interfacing with 8051


Full Drive Unipolar Stepper Motor interfacing with 8051

/*  Name     : main.c
 *  Purpose  : Source code for interface Stepper Motor with 8051 Microcontroller (AT89C52)
 *  Author   : vijayaraja R
 *  Date     : 2014-01-22
 *  Website  : www.gemicates.org
 *  Revision : None
 */
 
/**** Full step drive Mode****/
#include <REGX52.H>
#include<stdio.h>

#define motor P2
void delay(int sec);

void main()							        //main function
{
  do
  {
    motor = 0x03; 							//0011
		delay(100);
		motor = 0x06; 						//0110
		delay(100);
		motor = 0x0C; 						//1100
		delay(100);
		motor = 0x09; 						//1001
		delay(100);	
  }
while(1);
}

void delay(int sec)							//Function provide msec delay 
{
  int i,j;
  for(i=0;i<sec;i++)
  for(j=0;j<1000;j++);
}
Half Drive Unipolar Stepper Motor interfacing with 8051

/*  Name     : main.c
 *  Purpose  : Source code for interface Stepper Motor with 8051 Microcontroller (AT89C52)
 *  Author   : vijayaraja R
 *  Date     : 2014-01-22
 *  Website  : www.gemicates.org
 *  Revision : None
 */
 
/**** Half Drive Stepping Mode ****/
#include <REGX52.H>
sfr stepper=0xA0;					    // GPIO P2 declaration

void delay(unsigned int count)
{ 
	int i,j;
	for(i=0;i<count;i++)
	for(j=0;j<1025;j++);
}

void main()						    // main function
{
	while(1)
	{
		stepper=0x01;
		delay(100);
		stepper=0x03;
		delay(100);
		stepper=0x02;
		delay(100);
		stepper=0x06;
		delay(100);
		stepper=0x04;
		delay(100);
		stepper=0x0C;
		delay(100);
		stepper=0x08;
		delay(100);
		stepper=0x09;
		delay(100);
	}
}
Wave Drive Unipolar stepper Motor interfacing with 8051

/*  Name     : main.c
 *  Purpose  : Source code for interface Stepper Motor with 8051 Microcontroller (AT89C52)
 *  Author   : vijayaraja R
 *  Date     : 2014-01-17
 *  Website  : www.gemicates.org
 *  Revision : None
 */
 
/**** Wave Drive Stepping Mode****/
/******Single-Coil Excitation******/
#include <REGX52.H>
#include<stdio.h>

#define motor P2
void delay(int sec);

void main()					    // main function
{
  do
  {
    motor=0x01;                                     // 0001
    delay(1000);
    motor=0x02;                                     // 0010
    delay(1000);
    motor=0x04;                                     // 0100
    delay(1000);
    motor=0x08;                                     // 1000
    delay(1000);	
  }
while(1);
}

void delay(int sec)				    // Function provide msec delay 
{
  int i,j;
  for(i=0;i<sec;i++)
  {
    for(j=0;j<100;j++)
    {}
  }
}
Bipolar Stepper Motor interfacing with 8051

/*  Name     : main.c
 *  Purpose  : Source code for interface Bipolar Stepper Motor with 8051(AT89C52).
 *  Author   : Gemicates
 *  Date     : 2014-01-22
 *  Website  : www.gemicates.org
 *  Revision : None
 */
 
/**** Bipolar Stepper Motor ****/
#include <REGX52.H>
sfr stepper=0xA0; // GPIO P2 declaration

void delay(int);

void main()
{
  do
  {
    stepper=0x01; //0001
    delay(1000);
    stepper=0x04; //0100
    delay(1000);
    stepper=0x02; //0010
    delay(1000);
    stepper=0x08; //1000
    delay(1000);
  }while(1);
}

void delay(int sec)
{
  int i,j;
  for(i=0;i<sec;i++)
  {
    for(j=0;j<100;j++)
    {}
  }
}
Bipolar stepper motor interfacing with 8051

Unipolar stepper motor (Full step drive) interfacing with 8051

Error message here!

Show Error message here!


Forgot your password?

Error message here!

Send OTP

Error message here!

Show Error message here!


Lost your password? Please enter your email address. You will receive a password you Need.

Send Error message here!


Back to log-in

Close